package com.earth.a.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.earth.c.controller.BaseController;
import com.earth.c.render.Result;

@Controller
public class ErrorController extends BaseController{

	
	@GetMapping(value = "/error/backJson")
	@ResponseBody
	public Result backJson( int code, String error) {
		return new Result(code, error);
	}

	@GetMapping(value = "/error/backHtml")
	public String backHtml(int code, String error) {
		if (401 == code) {
			return "redirect:/login";
		} else {
			return "redirect:/error.html";
		}
	}
	
}
